package com.company.model;

import com.company.model.request.FeedbackRequest;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "feedbacks")
public class Feedback implements Serializable {

  private static final long serialVersionUID = -5008678157939008678L;
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  private Long id;
  @Column(name = "content")
  private String content;

  @Column(name = "contact")
  private String contact;
  @Column(name = "create_time")
  private Date createTime;

  @Column(name = "create_user")
  private String createUser;

  public Feedback() {
  }

  public Feedback(FeedbackRequest info, String createUser) {
    this.createUser = createUser;
    contact = info.getContact();
    content = info.getContent();
    createTime = new Date();
  }

  @Override
  public String toString() {
    return "Feedback{" +
        "id=" + id +
        ", content='" + content + '\'' +
        ", contact='" + contact + '\'' +
        ", createTime=" + createTime +
        ", createUser='" + createUser + '\'' +
        '}';
  }
}
